<template>
	<view class="big-box">
		<!-- 基本信息 -->
		<view class="jh-bg-white jh-w-p-100 jh-h-380-min jh-m-t-20 jh-p-20 jh-b-r-8">
			<!-- 图片 -->
			<view class="jh-w-p-100 jh-h-200-min jh-flex jh-justify-between">
				<!-- <u-album :urls="urls2" multipleSize="60"></u-album> -->
				<image :src="item" mode="" v-for="(item,index) in urls2"
					class="jh-w-200 jh-h-200  jh-m-lr-10 jh-m-b-20"></image>
			</view>
			<!-- 文字信息 -->
			<view class="jh-flex jh-flex-1 basic-info-h">
				<!-- 左侧 -->
				<view class="jh-flex jh-flex-column  jh-flex-1 jh-text-grey jh-justify-between">
					<text v-for="(item,index) in basicInfoLabel">{{item}}</text>
				</view>
				<!-- 右侧 -->
				<view class="jh-flex jh-flex-column jh-justify-between jh-flex-2 ">
					<text class="jh-text-bold">{{info.educName}}</text>
					<text class="">{{info.educId}}</text>
					<view class="jh-flex">
						<text
							:class="info.educSex == 0 ? 'jh-text-cyan' : 'jh-text-pink'">{{info.educSex == '0'?'男':'女' }}</text>
						<image style="width:44rpx;height:44rpx;" src="../../static/details/男.png"
							v-if="info.educSex == 0"></image>
						<image style="width:44rpx;height:44rpx;" src="../../static/details/女.png" v-else></image>
					</view>
					<text v-if="info.educType==3" class="">其他</text>

					<text v-if="info.educType==0" class="">在校大学生</text>
					<text v-if="info.educType==1" class="">在校研究生</text>
					<text v-if="info.educType==2" class="">专业教师</text>
					<text class="">{{info.educBirthday}}</text>
					<text class="">{{info.educColleges}}</text>
					<text class="">{{info.educSpeciality}}</text>
					<text class="">{{info.educEducation}}</text>
					<text class="">{{info.educYears}} 年</text>
					<text class="">{{info.educCurrent}}</text>
					<text class="">{{info.educAddress}}</text>
					<text class="">{{info.lastLogin ? info.lastLogin : '暂无记录'}}</text>
				</view>
			</view>
		</view>
		<!-- 个人简介 -->
		<view class="jh-bg-white jh-w-p-100 jh-h-100-min jh-m-t-20 jh-p-tb-30 jh-p-lr-20 jh-b-r-8">
			<view class="jh-text-pink title-size">个人简介</view>
			<view class="jh-m-t-10 "> <text>{{info.educProfile}}</text></view>
		</view>
		<!-- 任教科目 / 辅导方式 / 任教区域 / 收费标准 / 辅导时间-->
		<view class="jh-bg-white jh-w-p-100 jh-h-380-min jh-m-t-20 jh-p-tb-30 jh-p-lr-20 jh-b-r-8">
			<!-- 任教科目 -->
			<view class="jh-m-b-30">
				<view class="jh-text-pink title-size">任教科目</view>
				<view class=" jh-flex-1 jh-flex jh-flex-wrap">
					<view v-for="(item,index) in info.teacherChingDtos" :key="index"
						class="highlight-box  jh-w-20-min jh-h-30rpx jh-m-r-20 jh-m-t-20 ">
						{{item.fName}}{{item.zName}}
					</view>
				</view>
			</view>
			<!-- 辅导方式-->
			<view class="jh-m-b-30">
				<view class="jh-text-pink title-size">辅导方式</view>
				<view class=" jh-flex-1 jh-flex jh-flex-wrap">
					<view v-for="(item,index) in info.teacherCounselingDtos" :key="index"
						class="highlight-box  jh-w-20-min jh-h-30rpx jh-m-r-20 jh-m-t-20 ">
						{{item.counselingLable}}
					</view>
				</view>
			</view>
			<!-- 任教区域 -->
			<view class="jh-w-p-100 jh-h-100-min jh-b-r-8" v-if="info.teacherTeachingDtos">
				<view class="jh-text-pink title-size">任教区域</view>
				<view class="jh-m-t-10 "> <text class="jh-m-r-10" v-for="(er,ir) in info.teacherTeachingDtos"
						:key="ir">{{er.teacherTeachingLable}}</text></view>
			</view>
			<!-- 收费标准 -->
			<view class="jh-w-p-100 jh-h-100-min jh-b-r-8 jh-m-b-20">
				<view class="title-size jh-text-pink jh-m-t-20 jh-m-b-10">收费标准</view>
				<view class="">
					<text class="jh-text-bold">￥{{info.fess ? info.fess : 0.01}}元/小时</text>
					<text class="jh-m-l-100" @click="chargeStandardTo()">(查看平台参考标准)</text>
				</view>
			</view>
			<!-- 辅导时间 -->
			<view class="" v-if="position == '首页' ">
				<view class="title-size jh-text-pink jh-m-t-20 jh-m-b-10">辅导时间</view>
				<!-- 表格 -->
				<view class="jh-w-p-100 jh-h-200-min  jh-m-b-20">
					<view class="header-box">
						<view class="header">
							时间
						</view>
						<view class="header" v-for="(column, index) in dateList" :key="index">
							{{ column.fName }}
						</view>
					</view>
					<view class="jh-flex ">
						<view class="jh-flex-1">
							<view class="jh-flex">
								<view class="header">
									<text>上午</text>
								</view>
								<view class="header" v-for="(el,sw) in dateList" :key="sw">
									<view :class="!el.selectedMorning ? 'checkbox-cover':'checkbox-w'">
										<checkbox v-if="el.selectedMorning" :value="el.morning" :checked="el.morning"
											@click="checkboxTap(el,sw,1)" :disabled="position == '订单'" />
									</view>
								</view>
							</view>
							<view class="jh-flex">
								<view class="header">
									<text>下午</text>
								</view>
								<view class="header" v-for="(e,xw) in dateList" :key="xw">
									<view :class="!e.selectedAfternoon ? 'checkbox-cover':'checkbox-w'">
										<checkbox v-if="e.selectedAfternoon" :value="e.afternoon" :checked="e.afternoon"
											@click="checkboxTap(e,xw,2)" :disabled="position == '订单'" />
									</view>
								</view>
							</view>
							<view class="jh-flex">
								<view class="header">
									<text>晚上</text>
								</view>
								<view class="header" v-for="(ar,ws) in dateList" :key="ws">
									<view :class="!ar.selectedNight ? 'checkbox-cover':'checkbox-w'">
										<checkbox v-if="ar.selectedNight" :value="ar.night" :checked="ar.night"
											@click="checkboxTap(ar,ws,3)" :disabled="position == '订单'" />
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

				<view class="jh-flex jh-flex-column">
					<text>上午：8:00-9:00；9:00-10:00</text>
					<text>下午：14:00-15:00；15:00-16:00</text>
					<text>晚上：19:00-20:00；20:00-21:00</text>
				</view>
			</view>
		</view>
		<!-- 任教订单 -->
		<view class="jh-bg-white jh-w-p-100 jh-h-100-min jh-m-t-20 jh-p-tb-30 jh-p-lr-20 jh-b-r-8"
			v-if="orderList.length > 0">
			<view class=" jh-w-p-100 jh-flex jh-justify-between">
				<text class="jh-text-pink title-size">任教订单</text>
				<text class="jh-text-grey" @click="viewOder()">查看更多>></text>
			</view>
			<!-- 订单列表 -->
			<view class="jh-m-t-10 jh-h-10-min">
				<view v-for="(item,index) in orderList" :key="index"
					class="jh-w-p-100 jh-h-160 jh-flex jh-flex-column jh-justify-around jh-lines-grey"
					:class="index == 0 ? '':'jh-solid-t'">
					<view class="">
						<text>订单号: {{item.orderId}}</text>
					</view>
					<view class="">
						<text>任教科目:</text>
						<text v-for="(el,i) in item.subjectsDtos" :key="i">{{el.name}}{{el.subjectsName}}
						</text>
					</view>
					<!-- 	<view class="">
						<text>任教时间: 2023-10-06</text>
					</view> -->
				</view>
			</view>
		</view>
		<!-- 推荐教师 -->
		<view class="jh-bg-white jh-w-p-100 jh-h-100-min jh-m-t-20 jh-p-tb-30 jh-p-lr-20 jh-b-r-8"
			v-if="position == '首页'">
			<view class="">
				<text class="jh-text-pink title-size">推荐教师</text>
			</view>
			<!-- 教师列表 -->
			<view class="jh-m-t-20 jh-h-10-min">
				<teacherList :teacherData="teacherData" @clickItem="clickItem"></teacherList>
			</view>
		</view>
		<!-- 立即预约讲师 -->
		<view class="jh-w-p-100 jh-h-160 jh-bg-white jh-fixed jh-b-0 jh-p-lr-40 jh-p-t-20" v-if="position =='首页'">
			<!-- 立即预约讲师 ↓ -->
			<u-button type="success" text="立即预约讲师" @click="reservationView()" v-if="tokenShow"></u-button>
			<!-- 登录↓ -->
			<u-button open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber" type="success" text="预约讲师"
				v-else></u-button>
		</view>
		<!-- 订单查看更多 -->
		<u-popup :show="orderShow" mode="bottom">
			<view class="jh-h-p-90" style="height: 90vh;">
				<view class="jh-flex jh-justify-between jh-p-lr-40 jh-solid-b jh-l-h-100 jh-h-100">
					<view class="jh-w-80"></view>
					<text class="jh-text-bold-900">任教订单( {{orderList.length}} )</text>
					<u-icon name="close" color="#000" size="20" @click="orderShowClick()"></u-icon>
				</view>
				<scroll-view scroll-top="50" scroll-y="true" class="jh-h-p-90">
					<view class="jh-p-20 jh-w-p-100">
						<view v-for="(item,index) in orderList" :key="index"
							class="jh-w-p-100 jh-h-200 jh-flex jh-flex-column jh-justify-around jh-lines-grey"
							:class="index == 0 ? '':'jh-solid-t'">
							<view class="">
								<text>订单号: {{item.orderId}}</text>
							</view>
							<view class="">
								<text>任教科目:</text>
								<text v-for="(el,i) in item.subjectsDtos" :key="i">{{el.name}}{{el.subjectsName}}
								</text>
							</view>
							<!-- <view class="">
								<text>任教时间: 2023-10-06</text>
							</view> -->
						</view>
					</view>
				</scroll-view>
			</view>
		</u-popup>
		<!-- 立即预约教师弹窗 -->
		<u-popup :show="reservationShow" mode="bottom">
			<view class="jh-h-p-90" style="height: 90vh;">
				<view class="jh-flex jh-justify-between jh-p-lr-40  jh-l-h-100 jh-h-100" v-if="!coachingTargetsShow">
					<text></text>
					<text class=""></text>
					<u-icon name="close" color="#000" size="20"
						@click="reservationShow = false, selectedTimeData = []	 "></u-icon>
				</view>
				<view class="jh-w-p-100 jh-flex jh-justify-center jh-p-lr-40 jh-solid-b jh-l-h-100 jh-h-100" v-else>
					<text class="jh-text-bold-900">选择辅导对象</text>
				</view>
				<!-- 主体部分 -->
				<view class="jh-p-20" v-if="!coachingTargetsShow">
					<!-- 家教老师 -->
					<view class="jh-m-b-30">
						<view class="jh-text-pink title-size">家教老师</view>
						<view class=" jh-h-180-min jh-flex jh-m-t-20">
							<view class="jh-flex jh-flex-column  jh-flex-1 jh-text-grey jh-justify-between">
								<text>姓名</text>
								<text>ID</text>
								<text>性别</text>
								<text>类型</text>
							</view>
							<view class="jh-flex jh-flex-column jh-justify-between jh-flex-2 ">
								<text class="jh-text-bold">{{info.educName}}</text>
								<text class="">{{info.educId}}</text>
								<view class="jh-flex">
									<text
										:class="info.educSex == 0 ? 'jh-text-cyan' : 'jh-text-pink'">{{info.educSex == '0'?'男':'女' }}</text>
									<image style="width:44rpx;height:44rpx;" src="../../static/details/男.png"
										v-if="info.educSex == '0'"></image>
									<image style="width:44rpx;height:44rpx;" src="../../static/details/女.png" v-else>
									</image>
								</view>
								<text v-if="info.educType==0" class="">在校大学生</text>
								<text v-if="info.educType==1" class="">在校研究生</text>
								<text v-if="info.educType==2" class="">专业教师</text>
								<text v-if="info.educType==3" class="">其他</text>
							</view>
						</view>
					</view>
					<!-- 辅导对象 -->
					<view class="jh-bg-white jh-w-p-100 jh-h-100-min jh-m-t-20 jh-p-tb-30  jh-b-r-8">
						<view class="jh-w-p-100 jh-flex jh-justify-between">
							<text class="jh-text-pink title-size">辅导对象</text>
							<u-icon name="arrow-right" color="#909399" size="20" @click="coachingTargetsShow = true"
								v-if="coachingTargetsData.length > 0"></u-icon>
						</view>
						<view class=" jh-h-180-min jh-flex jh-m-t-20" v-if="coachingTargetsData.length > 0">
							<view class="jh-flex jh-flex-column  jh-flex-1 jh-text-grey jh-justify-between">
								<text>姓名</text>
								<text>性别</text>
								<text>年龄</text>
								<text>科目</text>
								<text>基本情况</text>
							</view>
							<view class="jh-flex jh-flex-column jh-justify-between jh-flex-2 "
								style=" white-space: nowrap;">
								<text class="jh-text-bold">{{coachingTargetsObj.counsellingName}}</text>
								<text>{{coachingTargetsObj.counsellingSex == '0'?'男':'女' }}</text>
								<view class="">
									<text class="">{{coachingTargetsObj.age}}岁 </text>
									<text>({{coachingTargetsObj.counsellingBirth}}出生)</text>
								</view>
								<text
									class="">{{coachingTargetsObj.counsellingBasic ? coachingTargetsObj.counsellingBasic : '无'}}</text>
							</view>
						</view>
						<view class="jh-h-150 jh-flex jh-flex-column jh-justify-between" v-else>
							<text class="jh-m-tb-30 ">当前没有辅导对象请先添加</text>
							<u-button type="success" shape="circle" text="添加辅导对象"
								@click="coachingTargetsGo()"></u-button>
						</view>
					</view>
					<!-- 任教时间 -->
					<!-- 	<view class="jh-bg-white jh-w-p-100 jh-h-60-min jh-p-tb-30  jh-b-r-8 jh-solid-b jh-line-w-6">
						<view class="jh-w-p-100">
							<text class="jh-text-pink title-size">任教时间</text>
						</view>
						<view class="jh-m-t-20">
							<view class="">
								<text>2023-10-11周一：上午,下午,晚上</text>
							</view>
							<view class="">
								<text>2023-10-12周二：上午,下午,晚上</text>
							</view>
						</view>
					</view> -->
					<!-- 总金额 -->
					<view class="jh-flex-1 jh-p-t-100 jh-text-center">
						<view class="">
							<text class="jh-text-pink">此次家教辅导总计金额(元)</text>
						</view>
						<view class="jh-m-tb-50">
							<text class="jh-text-bold jh-text-72">{{allMoney ? allMoney :0.01}}</text>
						</view>
						<u-button type="success" shape="circle" text="立即支付" :disabled="coachingTargetsData.length == 0"
							@click="paymentGo()"></u-button>
					</view>
				</view>
				<!-- 辅导对象列表 -->
				<view class="jh-p-lr-20" v-else>
					<view class="jh-h-200 jh-p-tb-20 jh-solid-b jh-flex" v-for="(item,index) in coachingTargetsData">
						<u-radio-group v-model="highlight">
							<image src="/static/details/头像男孩.png"
								style="width: 170rpx;height: 170rpx;border-radius: 10000rpx; "
								v-if="item.counsellingSex == 0">
							</image>
							<image src="/static/details/头像女孩.png"
								style="width: 170rpx;height: 170rpx;border-radius: 10000rpx; "
								v-if="item.counsellingSex == 1">
							</image>
							<view class="jh-w-460 jh-flex jh-flex-column jh-justify-between jh-m-l-20">
								<!-- 名字 性别 年龄 -->
								<view class="">
									<text class="jh-text-bold ">{{item.counsellingName}}</text>
									<text class="jh-m-l-20 jh-m-r-10">{{item.counsellingSex == '0' ? '男' : '女' }}</text>
									|
									<text class="jh-m-l-10">{{item.age}}岁</text>
								</view>
								<view class="">
									<text>{{item.counsellingBirth}} 出生</text>
								</view>
								<view class="">
									<text>{{item.counsellingBasic}}</text>
								</view>
							</view>
							<view class=" jh-flex jh-flex-column jh-justify-center">
								<u-radio :name="item.id"></u-radio>
							</view>
						</u-radio-group>
					</view>

					<view class="jh-absolute jh-b-80" style="width: 94%;">
						<u-button type="success" shape="circle" text="确定" @click="determineObj()"></u-button>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import teacherList from "components/teacherList/index.vue"
	import {
		wxLogin,
		coachingTargets,
		listOpenId
	} from "api/my/index.js"
	import {
		setToken,
		getToken,
		removeToken
	} from '@/lib/auth.js'
	import {
		deskTutor,
		oderListTeaching,
		payOrder
	} from "api/index/index.js"
	import {
		getCurrentScope
	} from "vue"
	export default {
		components: {
			teacherList
		},
		data() {
			return {
				highlight: 0,
				// 辅导对象列表出现
				coachingTargetsShow: false,
				// 辅导对象当前
				coachingTargetsObj: {},
				// 辅导对象列表
				coachingTargetsData: [],
				// 预约教师弹窗
				reservationShow: false,
				// 订单查看更多
				orderShow: false,
				// 有空时间头部
				columns: ['时间', '周一', '周二', '周三', '周四', '周五', '周六', '周日'],
				// 有空时间
				dateList: [],

				// 订单列表
				orderList: [],
				// 基本信息左侧
				basicInfoLabel: [
					'姓名', 'ID', '性别', '类型', '出生年月', '高校', '专业', '学历', '教龄', '籍贯', '现住址', '最后登录时间'
				],
				// 个人信息
				info: {},
				// 图片展示
				urls2: [],
				// 推荐教师
				teacherData: [],
				// 教师id
				teacherId: null,
				// 位置
				position: '',
				// 已选订单列表
				selectedTimeData: [],
				// 总需要的元
				allMoney: 0,
				// 本地token
				token: '',
				// 通过token判断的参数
				tokenShow: false
			}
		},
		onShow() {
			this.selectedTimeData = []
			this.token = uni.getStorageSync('token')
			if (uni.getStorageSync('token')) {
				this.tokenShow = true
			}
		},
		onLoad(val) {
			let data = JSON.parse(val.data)
			// 教师id
			this.teacherId = data.teacherId
			this.position = data.position
			this.deskTutorGet()
		},
		methods: {
			// 查找教师个人
			deskTutorGet() {
				deskTutor({
					id: this.teacherId
				}).then(res => {
					this.info = res.rows[0]
					this.urls2.push('https://educationafter.jinghaischool.com' + res.rows[0].educPhoto)
					// res.rows[0].educPhotos.forEach(el => {
					// 	this.urls2.push('https://educationafter.jinghaischool.com' + el.photoName)
					this.dateList = res.rows[0].teacherTeatimeDtos
					// })
					this.oderListGet(2)
				})
				// 名师推荐
				deskTutor({
					pageNum: 2,
					pageSize: 3
				}).then(res => {
					this.teacherData = res.rows
				})
			},
			// 获取辅导对象
			myCoaching() {
				// 辅导对象
				coachingTargets({
					userId: uni.getStorageSync('openId')
				}).then(res => {
					if (res.rows.length > 0) {
						this.highlight = res.rows[0].id
						this.coachingTargetsObj = res.rows[0]
						this.coachingTargetsData = res.rows
					} else {
						// uni.redirectTo({
						// 	url: '/pages/addCounsellObj/addCounsellObj',
						// });
						// uni.showToast({
						// 	title: '请先添加辅导对象',
						// 	//将值设置为 success 或者直接不用写icon这个参数
						// 	icon: 'none',
						// 	//显示持续时间为 2秒
						// 	duration: 2000
						// })
					}
				})
			},
			// 订单列表
			oderListGet(size) {
				oderListTeaching({
					pageSize: size,
					teacherName: this.info.educName
				}).then(res => {
					if (res.rows) {
						this.orderList = res.rows
					}
				})

			},
			// 点击教师列表
			clickItem(e) {
				let data = {
					teacherId: e.id,
					position: '首页'
				}
				uni.navigateTo({
					url: '/components/teacherDetails/teacherDetails?data=' + JSON.stringify(data)
				});
			},
			// 辅导时间选择
			checkboxTap(e, index, num) {
				// console.log(e, index, num, 'sdfrssssssss');
				// 上午
				if (num == 1) {
					if (e.morning == true) {
						e.morning = false
					} else {
						e.morning = true
					}
				}
				// 下午
				if (num == 2) {
					if (e.afternoon == true) {
						e.afternoon = false
					} else {
						e.afternoon = true
					}
				}
				// 晚上
				if (num == 3) {
					if (e.night == true) {
						e.night = false
					} else {
						e.night = true
					}
				}
			},
			// 查看标准
			chargeStandardTo() {
				uni.navigateTo({
					url: '/pages/chargeStandard/chargeStandard'
				});
			},
			// 关闭任教订单
			orderShowClick() {

				this.oderListGet(2)
				this.orderShow = false
			},
			// 查看更多订单
			viewOder() {
				this.orderShow = true
				this.oderListGet(100000)
			},
			// 预约教师弹窗打开
			reservationView() {
				this.reservationShow = true
				this.myCoaching()
				// 是勾选的时间this.selectedTimeData
				let morningNum = []
				let afternoonNum = []
				let nightNum = []
				this.dateList.forEach(el => {
					if (el.morning) {
						this.selectedTimeData.push({
							childLevel: 'morning',
							fId: el.fId,
							hours: new Date(el.specificDate)
						})
						morningNum.push({
							childLevel: 'morning',
						})
					}
					if (el.afternoon) {
						this.selectedTimeData.push({
							childLevel: 'afternoon',
							fId: el.fId,
							hours: new Date(el.specificDate)
						})
						afternoonNum.push({
							childLevel: 'afternoon',
						})
					}
					if (el.night) {
						this.selectedTimeData.push({
							childLevel: 'night',
							fId: el.fId,
							hours: new Date(el.specificDate)
						})
						nightNum.push({
							childLevel: 'night',
						})
					}
				})
				let num = 0
				// num = morningNum ? morningNum.length : 0  + afternoonNum ? afternoonNum.length : 0  +nightNum ? nightNum.length : 0
				num = morningNum.length + afternoonNum.length + nightNum.length
				// console.log('morningNum==',morningNum);
				// console.log('afternoonNum==',afternoonNum);
				// console.log('nightNum==',nightNum);
				// console.log(num,'一共几个'); 
				this.allMoney = num * 2 * this.info.fess
				// console.log('this.allMoney====',this.allMoney);
			},
			// 确定辅导对象
			determineObj() {
				this.coachingTargetsData.forEach(el => {
					if (this.highlight == el.id) {
						this.coachingTargetsObj = el
					}
				})
				this.coachingTargetsShow = false
			},
			// 立即支付
			paymentGo() {
				console.log('价格===', this.allMoney)
				console.log('openId===', uni.getStorageSync('openId'))
				console.log('老师Id===', this.teacherId);
				console.log('辅导对象Id===', this.highlight);
				console.log('勾选之后获得的辅导时间list===', this.selectedTimeData);
				let obj = {
					// 价格
					rechargePrice: this.allMoney == 0 ? 0.01 : this.allMoney,
					// rechargePrice: 0.01,
					// openId
					openId: uni.getStorageSync('openId'),
					// 家教Id
					teacherId: this.teacherId,
					// 辅导对象Id
					targetsId: this.highlight,
					// 辅导订单时间
					orderCounList: this.selectedTimeData
				}
				// 如果勾选了辅导时间就执行支付
				if (this.selectedTimeData.length > 0) {
					console.log(this.selectedTimeData, 'this.selectedTimeData');
					payOrder(obj).then(res => {
						wx.requestPayment({
							partnerid: "1625904710", // 商户号（PartnerID）
							timeStamp: res.timeStamp,
							nonceStr: res.nonceStr,
							package: res.package,
							signType: res.signType,
							paySign: res.paySign,
							success(res) {
								uni.switchTab({
									url: '/pages/index/index'
								})
							},
							fail(e) {}
						})
					})
				} else {
					this.reservationShow = false
					uni.showToast({
						title: '请先选择辅导时间再进行支付',
						//将值设置为 success 或者直接不用写icon这个参数
						icon: 'none',
						//显示持续时间为 2秒
						duration: 3000
					})
				}
			},
			// 添加辅导对象
			coachingTargetsGo() {
				this.reservationShow = false
				uni.navigateTo({
					url: '/pages/addCounsellObj/addCounsellObj'
				});
			},
			// 微信一键登录
			decryptPhoneNumber(e) {
				if (e.detail.errMsg == "getPhoneNumber:ok") {
					//  e.detail.code 调用接口传给后端获取手机号
					console.log(e.detail.code);

					this.clickLogon()
				}
			},
			// 微信登录
			clickLogon() {
				wx.login({
					provider: 'weixin',
					success: (res) => {
						// 调用登录接口
						wxLogin({
							code: res.code
						}).then(res => {
							const now = new Date(res.data.data).getTime();
							let data = res.data.user
							setToken(res.data.token)
							wx.setStorageSync('openId', data.openid);
							wx.setStorageSync('sessionKey', data.session_key);
							// 本地存储 user
							wx.setStorageSync('user', JSON.stringify(data));
							// this.$store.commit("SET_USER", data);
							this.myCoaching()

							uni.showToast({
								title: '登录成功',
								//将值设置为 success 或者直接不用写icon这个参数
								icon: 'none',
								//显示持续时间为 2秒
								duration: 2000
							})
							this.tokenShow = true
							console.log('456', this.token);

						})
					},

				})
			}
		},
	}
</script>

<style scoped>
	.basic-info-h {
		height: 580rpx;
	}

	.title-size {
		font-size: 29rpx;
	}

	.highlight-box {
		background-color: #E6F8E8;
		color: #70cf16;
		padding: 5rpx 20rpx;
	}

	.big-box {
		width: 96%;
		padding: 0 0 100rpx 0;
		margin: auto;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}


	.header-box {
		display: flex;
		height: 58rpx;
		line-height: 58rpx;
	}

	.header {
		height: 70rpx;
		line-height: 70rpx;
		border: #D7D7D7 1rpx solid;
		flex: 1;
		/* padding: 5rpx; */
		text-align: center;
		background-color: white;
	}

	.data-row {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.item-row {
		display: flex;
		justify-content: center;

	}

	.checkbox-w {
		height: 80rpx;
		padding: 0rpx 0rpx 0rpx 10rpx;
	}

	.checkbox-cover {
		background-color: #D7D7D7;
		padding: 0rpx;
		height: 100%;
		width: 100%;
	}

	table {
		border-collapse: collapse;
	}
</style>